package io.xxx.walle.assistant;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.Optional;

public interface TokenRepository extends JpaRepository<Token, Long> {

    Optional<Token> findByUsed(boolean used);

    @Modifying
    @Query("update Token t set t.qrcode = :id, t.updatedTime = current_timestamp where t.id = :qrcode")
    void updateQrcode(Long id, String qrcode);
}
